<!DOCTYPE html>
<html lang="en">
<!-- 提交报修信息页面 -->
<?php
// 判断是否正常访问
session_start();
if (!isset($_SESSION['USER'])) {
    echo "<script>alert('非法访问！请先登录！');window.location.href='../../../index.html';</script>";
    die();
}
?>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>校园报修系统 · 用户</title>
    <link rel="icon" href="../img/ICO.png">
    <link rel="stylesheet" href="../bootstrap-5.3.3-dist/bootstrap.min.css">
    <link rel="stylesheet" href="css/all.min.css">
    <script src="../bootstrap-5.3.3-dist/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/u-public.css">
    <link rel="stylesheet" href="css/u-send-fixinfo.css">
    <script src="js/u-send-fixinfo.js"></script>
</head>

<body>
    <header class="sticky-top">
        <nav class="navbar navbar-expand-lg bg-body-tertiary bg-dark border-body" data-bs-theme="dark">
            <div class="container-fluid">
                <a class="navbar-brand" href="u-main.php">
                    <img src="../img/logo-0.png" alt="Logo" height="50" class="d-inline-block align-text-top">
                </a>
                <div class="collapse navbar-collapse" id="navbarNav">
                    <i class="fas fa-map-marker-alt" style="color: white;"> 位置：</i>
                    <ul class="navbar-nav">
                        <li class="nav-item">
                            <a class="nav-link" href="u-main.php">首页 &gt;</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link active" aria-current="page" href="javascript:;">提交报修申请</a>
                        </li>
                    </ul>
                </div>
                <span class="navbar-text navbar-text-control">
                    <i class="fa fa-user-friends" style="color: white; font-size: 25px"></i>
                    当前登录：<?php echo $_SESSION['USER']["u_name"]; ?>
                </span>
                <a class="navbar-brand" href="php/logout.php">
                    <i class="far fa-arrow-alt-circle-left" style="color: white; font-size: 25px" title="退出登录"></i>
                </a>
            </div>
        </nav>
    </header>
    <main>
        <div class="main-div">
            <div class="main-div-fixinfo-form">
                <h2><i class="fas fa-angle-double-up" style="font-size: 30px;"></i> 报修表单</h2>
                <span class="fixinfo-form-tips">请按实际情况填写，仔细核对，提交后不可更改</span>
                <hr>
                <form class="row g-3" action="php/send-fixinfo.php" method="post" enctype="multipart/form-data" id="sendfix-div">
                    <input type="hidden" name="uid" value="<?php echo $_SESSION['USER']["u_id"]; ?>">
                    <div class="col-md-7">
                        <label for="u_name" class="form-label">报修人姓名</label>
                        <input type="text" class="form-control" id="u_name" name="u_name" placeholder="请填写真实姓名"
                            required>
                    </div>
                    <div class="col-md-7">
                        <label for="u_phone" class="form-label">报修人电话</label>
                        <input type="text" class="form-control" id="u_phone" name="u_phone" value="<?php echo $_SESSION['USER']["u_phone"]; ?>" placeholder="请填写接听电话"
                            required>
                    </div>
                    <div class="col-12">
                        故障发生区域<br><br>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="教学楼" checked>
                            <label class="form-check-label" for="inlineRadio1">教学楼</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="机房">
                            <label class="form-check-label" for="inlineRadio1">机房</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="学生宿舍（男）">
                            <label class="form-check-label" for="inlineRadio2">学生宿舍（男）</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="学生宿舍（女）">
                            <label class="form-check-label" for="inlineRadio3">学生宿舍（女）</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="教师宿舍">
                            <label class="form-check-label" for="inlineRadio3">教师宿舍</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="图书馆">
                            <label class="form-check-label" for="inlineRadio3">图书馆</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_area" value="实训中心">
                            <label class="form-check-label" for="inlineRadio3">实训中心</label>
                        </div>
                    </div>

                    <div class="col-12">
                        <label for="fullAddress" class="form-label">详细地址</label>
                        <input type="text" class="form-control" id="fullAddress" name="fullAddress"
                            placeholder="请填写详细地址，如：厚德楼2楼201" required>
                    </div>
                    <div class="col-md-5">
                        <label for="inputState" class="form-label">故障类型</label>
                        <select id="fault_type" class="form-select" name="fault_type">
                            <option selected disabled value="none">---请选择---</option>
                            <!-- <option value="电脑故障">电脑故障</option> -->
                             <?php
                                include_once("php/get-fix-leave.php");
                             ?>
                        </select>
                    </div>
                    <div class="col-12">
                        故障原因<br><br>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_reason" value="自然损坏" checked>
                            <label class="form-check-label" for="R1">自然损坏</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_reason" value="人为破坏">
                            <label class="form-check-label" for="R2">人为破坏</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="fault_reason" value="其他">
                            <label class="form-check-label" for="R3">其他（或未知）</label>
                        </div>
                    </div>
                    <div class="col-12">
                        <label for="depicted" class="form-label">故障描述</label>
                        <textarea class="form-control" id="depicted" rows="5" name="depicted"
                            placeholder="请描述故障现象，如：电脑无法开机、水管断裂、玻璃破碎等..." required></textarea>
                    </div>
                    <div class="col-4">
                        <label for="fault_img" class="form-label">请上传一张故障图片</label>
                        <input class="form-control" type="file" id="fault_img" name="fault_img" accept="image/*">
                    </div>
                    <div class="col-12 fixinfo-form-sub-div">
                        <button type="submit" onclick="return SendFix()" class="btn btn-outline-primary submit-btn">提交报修信息</button>
                    </div>
                </form>
            </div>
        </div>
    </main>
    <footer class="fixed-bottom">
        校园报修系统© 2025®
    </footer>
</body>

</html>